#include"processBar.h"

char bar[NUM]={0};
char tmp[4] = {'|','/','-','\\'};
void processbar(int rate)
{
    if(rate<0||rate>100)return;
    int len=sizeof(tmp)/sizeof(tmp[0]);
    printf("[%-100s][%d%%][%c]\r",bar,rate,tmp[rate%len]);
    fflush(stdout);
    bar[rate++]=BODY;
    if(rate<100)bar[rate]=HEAD;
}

void InitBar()
{
    memset(bar,'\0',sizeof(bar));
}
